package com.example.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.model.SysJobInfo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface SysJobInfoMapper extends BaseMapper<SysJobInfo> {

    @Select("select * from SYS_JOB_INFO where job_run_time < #{nextTime} order by job_run_time desc")
    public List<SysJobInfo> findListByTime(@Param("nextTime") Long nextTime);

    @Update("update SYS_JOB_INFO set job_run_time = #{runTime} where id = #{jobId}")
    public void refreshRunTime(@Param("jobId") Integer jobId, @Param("runTime") Long runTime);
}
